package cn.kawa.feignClient;

import cn.kawa.domain.User;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 指定此接口是feign的客户端，fallbackFactory:指定扫描的降级类，那个类要加component
 */
@FeignClient(value = "user-server",fallbackFactory = UserFeignClientFallbackFactory.class)
@RequestMapping("/user")
public interface UserFeignClient {
    /**
     * 注意事项
     * 1.方法名称必须跟代理接口一致
     * 2.接口的参数和返回值必须跟代理方一致
     * 3.接口请求方法必须跟代理方一致
     * @param id
     * @return
     */
    @GetMapping("/getById/{id}")
    User getById(@PathVariable("id") Long id);
}
